﻿// -------------------------------------------------------------------------
//    @FileName         :    NFMilitantPart.cpp
//    @Author           :    gaoyi
//    @Date             :    24-8-30
//    @Email            :    445267987@qq.com
//    @Module           :    NFMilitantPart
//
// -------------------------------------------------------------------------

#include "NFMilitantPart.h"

#include "proto_cs_login.pb.h"
#include "proto_db.pb.h"

NFMilitantPart::NFMilitantPart()
{
    if (EN_OBJ_MODE_INIT == NFShmMgr::Instance()->GetCreateMode())
    {
        CreateInit();
    }
    else
    {
        ResumeInit();
    }
}

NFMilitantPart::~NFMilitantPart()
{
}

int NFMilitantPart::CreateInit()
{
    return 0;
}
    
int NFMilitantPart::ResumeInit()
{
    return 0;
}

int NFMilitantPart::LoadFromDB(const proto_ff::tbRoleDetail *pDBData)
{
    m_stData.FromPb(pDBData->role_play_data().militant_data());
    return 0;
}

int NFMilitantPart::InitConfig(proto_ff::tbRoleDetail *pDbData, const RoleOne &stRoleOne)
{
    CHECK_NULL(0, pDbData);
    auto pRoleMilitantMatchData = pDbData->mutable_role_play_data()->mutable_militant_data();
    CHECK_NULL(0, pRoleMilitantMatchData);

    pRoleMilitantMatchData->set_total_score(0);
    pRoleMilitantMatchData->set_max_win_comb(0);
    pRoleMilitantMatchData->set_total_win_count(0);
    pRoleMilitantMatchData->set_total_fight_count(0);
    pRoleMilitantMatchData->set_fight_honor(0);
    pRoleMilitantMatchData->set_militant_id(0);

    pRoleMilitantMatchData->set_cur_score(0);
    pRoleMilitantMatchData->set_win_comb(0);
    pRoleMilitantMatchData->set_win_count(0);
    pRoleMilitantMatchData->set_fight_count(0);
    pRoleMilitantMatchData->set_can_match(false);
    pRoleMilitantMatchData->set_end_time(0);
    pRoleMilitantMatchData->set_enter_time(0);
    pRoleMilitantMatchData->set_start_time(0);
    pRoleMilitantMatchData->set_in_militant(false);
    pRoleMilitantMatchData->set_lose_count(0);
    pRoleMilitantMatchData->set_militant_type(proto_ff::EN_MILITANT_TYPE_NONE);
    pRoleMilitantMatchData->set_next_match_time(0);
    pRoleMilitantMatchData->set_today_honor(0);
    pRoleMilitantMatchData->clear_win_reward();
    return 0;
}

int NFMilitantPart::SaveDB(proto_ff::tbRoleDetail *pDBData)
{
    m_stData.ToPb(pDBData->mutable_role_play_data()->mutable_militant_data());
    return 0;
}

int NFMilitantPart::MakePlayerDataCS(proto_ff::Proto_CSGetRoleRsp* pCSGetRoleRsp)
{
    m_stData.ToPb(pCSGetRoleRsp->mutable_militant_match_data());
    return 0;
}

int NFMilitantPart::MakeCityPlayerData(proto_ff::CityRoleInfo* pGCCityRoleInfo)
{
    return 0;
}
